package cn.com.headfree.workflowant.dao.impl;

import cn.com.headfree.entity.TBusinessWorkflowApproveBind;
import cn.com.headfree.entity.TBusinessWorkflowBind;
import cn.com.headfree.entity.TMouldInfo;
import cn.com.headfree.workflowant.dao.IBusinessWorkflowApproveBindDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: TODO
 * @Author wcSun
 * @Date 2021/7/12
 **/
@Repository("businessWorkflowApproveBindDao")
public class BusinessWorkflowApproveBindDaoImpl  extends BaseDaoImpl<TBusinessWorkflowApproveBind> implements IBusinessWorkflowApproveBindDao {

    @Override
    public void updateByBusinessTypeAndBusinessId(TBusinessWorkflowApproveBind businessWorkflowApproveBind) {
        String sql = "UPDATE t_business_workflow_approve_bind set ";
        StringBuilder sb = new StringBuilder(sql);
        sb.append(" handle_time=#{handle_time}");
        //sb.append(" deal_time=#{deal_time}");
        sb.append(" where approve_id=#{approve_id,jdbcType=VARCHAR} ");

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("handle_time", businessWorkflowApproveBind.getHandleTime());
        //params.put("deal_time", businessWorkflowApproveBind.getDealTime());
        params.put("approve_id", businessWorkflowApproveBind.getApproveId());
        this.executeSql(sb.toString(), params);
    }

    @Override
    public List<TBusinessWorkflowApproveBind> selectBusinessWorkflowApproveBindBybusinessId(String businessTypeId,String businessId) {
        return  this.findAllBySQL(TBusinessWorkflowApproveBind.class, "select * from t_business_workflow_approve_bind where business_type_id = ? and business_id = ?", null, false, new Object[] {businessTypeId,businessId});
    }

    @Override
    public List<TBusinessWorkflowApproveBind> selectBusinessWorkflowApproveBindByApproveId(String approveId) {
        return  this.findAllBySQL(TBusinessWorkflowApproveBind.class, "select * from t_business_workflow_approve_bind where approve_id = ?", null, false, new Object[] {approveId});
    }

}
